﻿<%@ Page Language="C#" AutoEventWireup="true"  MasterPageFile="~/MainMaster.master" CodeFile="tests.aspx.cs" Inherits="tests" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
       <script type="text/javascript">
        function there() {

            $("#dialog").jqm({ modal: true }).jqmShow();
//            var viewstate = document.getElementById("__VIEWSTATE");

//            alert(viewstate.value);
//            viewstate.value="0";

        }
        function there2() {

            $("#dialog2").jqm({ modal: true }).jqmShow();


        }

        function uploadError(sender, args) {
            var result = document.getElementById("<%= results.ClientID %>");
            result.value = "يوجد خطأ فى التحميل";
        }

        function uploadStarted(sender, args) {

            var fileName = args.get_fileName();
            // alert(fileName);


            var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);

            if (!(fileExtension == 'mrc' || fileExtension == 'txt')) {
                alert("mrc,txt الامتدادات المسموحة ");


                ifIgnoreError = true;
                sender._stopLoad();

            }


        }


        function uploadComplete(sender, args) {
            var contentType = args.get_contentType();
            var text = args.get_length() + " bytes";
            // alert(contentType);
            if (contentType.length > 0) {
                text += ", '" + contentType + "'";

            }
            var result = document.getElementById("<%= results.ClientID %>");
            result.value = text;
        }
       
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 <asp:UpdatePanel ID="up1" runat="server" ChildrenAsTriggers="true">
            <ContentTemplate>
    <div>
     <asp:AsyncFileUpload ID="AsyncFileUpload1" OnClientUploadError="uploadError"  
                            runat="server" Width="400px" UploadingBackColor="#CCFFFF" ThrobberID="myThrobber"
                            OnClientUploadStarted="uploadStarted" OnUploadedComplete="AsyncFileUpload1_UploadedComplete" />
                        <asp:Label runat="server" ID="myThrobber" Style="display: none;"> <img align="absmiddle" alt="" src="uploading.gif" /> </asp:Label>
                        <br />
                        <br />
                        <asp:Label ID="results" runat="server" Text="Label"></asp:Label>
                        <br />
    </div>
     </ContentTemplate>
        </asp:UpdatePanel>
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        </div>
    </asp:Content>
